Skip to content

feat(agentos): group-scoped encrypted git PATs + GAP source SHA sync#28

Merged
abhi-bhat-lyzr merged 1 commit into
deployfrom
feat/agentos-auth-rbac-refresh
Jun 6, 2026
Merged

feat(agentos): group-scoped encrypted git PATs + GAP source SHA sync#28
abhi-bhat-lyzr merged 1 commit into
deployfrom
feat/agentos-auth-rbac-refresh

Conversation

@abhi-bhat-lyzr
Copy link
Copy Markdown
Collaborator

Let the SDK clone private GAP repos with a group-owned PAT, stored encrypted on the AgentOS server and fetched with the SDK's API key.

Server:

  • crypto/secret-box.ts — AES-256-GCM at rest, keyed by AGENTOS_CREDENTIALS_KEY, with kid-based rotation (AGENTOS_CREDENTIALS_KEY_OLD). Fails closed.
  • stores/git-credential-store.ts — git_credentials collection, unique (ownerGroup, host) (re-upsert = rotation), normalizeGitHost, resolve().
  • routes/git-credentials.ts — CRUD (git-credentials:manage/:read, ownership)
    • POST /resolve for the SDK's cak_ key (strictly group-scoped, no admin bypass, no-store, token never logged). Mounted in the dashboard router.
  • permissions + agentos-editor seed; ensureIndexes wiring.
  • SHA sync: RegistryDoc.sourceSha/sourceSyncedAt, written from session_started payload.agent_sha; drift since the last run is logged.
  • tests: secret-box + git-credential-store.

SPA:

  • api.gitCredentials client + GitCredential type; Settings -> Git Credentials section (write-only secret) gated on git-credentials:read/:manage.

Ops:

  • scripts/provision-keycloak.mjs (pnpm provision:keycloak) — idempotent realm / roles / OIDC client / mappers / service-account provisioning.
  • .gitignore: ignore *.env (keycloak.env etc.).
  • CLAUDE.md: document auth/RBAC (§2.6b), git credentials + SHA sync (§2.6c), new collections, and all new env vars.

Note: clone-with-PAT is wired for the SDK LOCAL/library substrate. The remote (sandbox-at-CAS) and AgentOS->CAS dashboard paths reuse CAS's existing gitToken field and are a follow-up.

Summary

Type of change

  • Bug fix (no API change)
  • New feature (additive — opt-in or new export, no existing-behavior change)
  • Breaking change (requires major version bump on affected packages)
  • Docs / CI / tooling only

Verification

  • pnpm -r build clean
  • pnpm -r typecheck clean
  • pnpm -r test clean (note any flaky tests in the comment)
  • If a plug-in: runConformanceSuite() passes (paste report below)

Versioning

  • pnpm changeset was run for any change to a published package
  • N/A — internal-only change

Notes for the reviewer

Let the SDK clone private GAP repos with a group-owned PAT, stored encrypted
on the AgentOS server and fetched with the SDK's API key.

Server:
- crypto/secret-box.ts — AES-256-GCM at rest, keyed by AGENTOS_CREDENTIALS_KEY,
  with kid-based rotation (AGENTOS_CREDENTIALS_KEY_OLD). Fails closed.
- stores/git-credential-store.ts — git_credentials collection, unique
  (ownerGroup, host) (re-upsert = rotation), normalizeGitHost, resolve().
- routes/git-credentials.ts — CRUD (git-credentials:manage/:read, ownership)
  + POST /resolve for the SDK's cak_ key (strictly group-scoped, no admin
  bypass, no-store, token never logged). Mounted in the dashboard router.
- permissions + agentos-editor seed; ensureIndexes wiring.
- SHA sync: RegistryDoc.sourceSha/sourceSyncedAt, written from session_started
  payload.agent_sha; drift since the last run is logged.
- tests: secret-box + git-credential-store.

SPA:
- api.gitCredentials client + GitCredential type; Settings -> Git Credentials
  section (write-only secret) gated on git-credentials:read/:manage.

Ops:
- scripts/provision-keycloak.mjs (pnpm provision:keycloak) — idempotent realm /
  roles / OIDC client / mappers / service-account provisioning.
- .gitignore: ignore *.env (keycloak.env etc.).
- CLAUDE.md: document auth/RBAC (§2.6b), git credentials + SHA sync (§2.6c),
  new collections, and all new env vars.

Note: clone-with-PAT is wired for the SDK LOCAL/library substrate. The
remote (sandbox-at-CAS) and AgentOS->CAS dashboard paths reuse CAS's existing
gitToken field and are a follow-up.
@abhi-bhat-lyzr abhi-bhat-lyzr merged commit 0bb2111 into deploy Jun 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant